<template>
	<view class="page">
		<view class="form-content">
			<u-form :model="formData" ref="uForm" class="uForm" label-position="top">
				<u-form-item prop="needamount" label="信息服务费(元)" label-width="auto">
					<u-input v-model="formData.amount" type="number" placeholder="请输入信息服务费" />
				</u-form-item>
				<u-form-item prop="attachmentInfo" label="附件信息" label-width="auto">
					<JNPFUpload v-model="attendanceFileList" :fileSize='2' :limit='10' :showLabel="false"
						@uploading="uploading">
					</JNPFUpload>
				</u-form-item>
			</u-form>
		</view>
		<view class="save-bottom">
			<view class="fixed-btn save-padding">
				<u-button type="primary" shape="circle" @click="onSubmit">确定</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import dateTime from '@/components/dateTime/dateTime.vue'

	import jnpf from '@/common/js/jnpf.js'
	export default {
		components: {
			dateTime
		},
		name: 'customerBase',
		data() {
			return {
				formData: {
					amount: undefined,
					customerId: undefined,
					attachment: undefined
				},
				attendanceFileList: []
			}
		},
		onLoad(options) {
			if (options.id) {
				this.formData.customerId = options.id
			}
		},
		methods: {
			/* 表单提交 */
			onSubmit() {
				this.formData.attachmentInfo = this.attendanceFileList.map(item => {
					return item.url
				}).join(',')
				let url = "/api/Jiushi/Customerconsultant";
				let method = "POST";
				this.$helper.ajax({
					url: url,
					method: method,
					contentType: "application/json",
					data: this.formData,
					success: res => {
						this.$helper.msg(res.data.msg, 'success');
						uni.navigateTo({
							url: '/pagesJiushi/consultant/myconsultantlist'
						})
					},
					fail: res => {

					}
				});
			},
		}
	}
</script>

<style>

</style>